package com.yicong.ants.bean.reimburse;

import android.graphics.Color;
import android.text.TextUtils;

import com.cchao.simplelib.core.Logs;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 * @author cchao
 * @version 2019-08-02.
 */
public class ReimburseHistoryBean {

    /**
     * advance_id : 490437
     * account_type : 1
     * account : 18200555448
     * real_name : 哒哒哒啊
     * refund_amount : 88.89
     * remark : 备注信息啊
     * pay_img : http://qiniu.upload.yytxlyw.com/2019-07-19_5d312e8a00559.jpg
     * ticket_img : http://qiniu.upload.yytxlyw.com/2019-07-19_5d312e8dd5764.jpg
     * add_time : 2019-07-13 16:20:36
     * status : 4
     * status_detail : 财务审核不通过
     * reason : 账号不对
     * review_time : 2019-07-24 10:58:11
     * scenic_id : 4382
     * advance_date : 2019-07-19
     * scenic_name : 流星谷水上乐园
     * address : 广东省深圳市宝安区沙井镇洪田火山公园
     * thumbnail : http://zslyadmin.yytxlyw.com/Uploads/Picture/2019-07-23/6b94cd0e4c7.jpg
     */

// 1-支付宝，2-微信，3-银行卡

    private String advance_id;
    private int account_type;
    private String account;
    private String real_name;
    private String refund_amount;
    private String remark;
    private String pay_img;
    private String ticket_img;
    private String add_time;
    private int status;
    private String status_detail;
    private String reason;
    private String review_time;
    private String senic_id;
    private String advance_date;
    private String senic_name;
    private String address;
    private String thumbnail;
    private String bank;

    private String typeText;

    public ReimburseHistoryBean() {
    }

    public String getTypeText() {
        switch (account_type) {
            case 1:
                return "支付宝";
            case 2:
                return "微信";
            case 3:
                return "银行卡";
        }
        return "银行卡";
    }

    private boolean cancelable = false;
    private boolean ticketAble = false;
    private String statusStr;
    private int statusColor;

    public String getStatusStr() {
        // 1:待审核  2:审核成功  3:取消预约]
        switch (status) {
            case 1:
                return "待审核";
            case 2:
                return "审核成功";
            case 3:
                return "取消预约";
        }
        return "待审核";
    }

    public int getStatusColor() {
        // 1:待审核  2:审核成功  3:取消预约]
        switch (status) {
            case 1:
                return Color.parseColor("#229FFD");
            case 2:
                return Color.parseColor("#00CDAC");
            case 3:
                return Color.parseColor("#FC6973");
        }
        return Color.parseColor("#229FFD");
    }

    public boolean getCancelable() {
        if (status <= 2 && getCancelLegal(advance_date)) {
            return true;
        }
        return false;
    }

    public boolean isCancelable() {
        return getCancelable();
    }

    /**
     * 判断取消预约景区是否合法
     * 需要在预约景区的前一天中午十二点之前方能取消
     */
    private boolean getCancelLegal(String time) {
        if (TextUtils.isEmpty(time)) {
            return false;
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        GregorianCalendar gcd = new GregorianCalendar();
        try {
            Date date = simpleDateFormat.parse(time);
            gcd.setTime(date);
            return (gcd.getTimeInMillis() - System.currentTimeMillis()) / (1000 * 3600) > 12;
        } catch (ParseException e) {
            e.printStackTrace();
            Logs.logException(e);
            return false;
        }
    }

    public String getAdvance_id() {
        return this.advance_id;
    }

    public int getAccount_type() {
        return this.account_type;
    }

    public String getAccount() {
        return this.account;
    }

    public String getReal_name() {
        return this.real_name;
    }

    public String getRefund_amount() {
        return this.refund_amount;
    }

    public String getRemark() {
        return this.remark;
    }

    public String getPay_img() {
        return this.pay_img;
    }

    public String getTicket_img() {
        return this.ticket_img;
    }

    public String getAdd_time() {
        return this.add_time;
    }

    public int getStatus() {
        return this.status;
    }

    public String getStatus_detail() {
        return this.status_detail;
    }

    public String getReason() {
        return this.reason;
    }

    public String getReview_time() {
        return this.review_time;
    }

    public String getSenic_id() {
        return this.senic_id;
    }

    public String getAdvance_date() {
        return this.advance_date;
    }

    public String getSenic_name() {
        return this.senic_name;
    }

    public String getAddress() {
        return this.address;
    }

    public String getThumbnail() {
        return this.thumbnail;
    }

    public String getBank() {
        return this.bank;
    }

    public boolean isTicketAble() {
        return this.ticketAble;
    }

    public void setAdvance_id(String advance_id) {
        this.advance_id = advance_id;
    }

    public void setAccount_type(int account_type) {
        this.account_type = account_type;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public void setReal_name(String real_name) {
        this.real_name = real_name;
    }

    public void setRefund_amount(String refund_amount) {
        this.refund_amount = refund_amount;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public void setPay_img(String pay_img) {
        this.pay_img = pay_img;
    }

    public void setTicket_img(String ticket_img) {
        this.ticket_img = ticket_img;
    }

    public void setAdd_time(String add_time) {
        this.add_time = add_time;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setStatus_detail(String status_detail) {
        this.status_detail = status_detail;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public void setReview_time(String review_time) {
        this.review_time = review_time;
    }

    public void setSenic_id(String senic_id) {
        this.senic_id = senic_id;
    }

    public void setAdvance_date(String advance_date) {
        this.advance_date = advance_date;
    }

    public void setSenic_name(String senic_name) {
        this.senic_name = senic_name;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public void setBank(String bank) {
        this.bank = bank;
    }

    public void setTypeText(String typeText) {
        this.typeText = typeText;
    }

    public void setCancelable(boolean cancelable) {
        this.cancelable = cancelable;
    }

    public void setTicketAble(boolean ticketAble) {
        this.ticketAble = ticketAble;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }

    public void setStatusColor(int statusColor) {
        this.statusColor = statusColor;
    }

    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof ReimburseHistoryBean)) return false;
        final ReimburseHistoryBean other = (ReimburseHistoryBean) o;
        if (!other.canEqual((Object) this)) return false;
        final Object this$advance_id = this.getAdvance_id();
        final Object other$advance_id = other.getAdvance_id();
        if (this$advance_id == null ? other$advance_id != null : !this$advance_id.equals(other$advance_id))
            return false;
        if (this.getAccount_type() != other.getAccount_type()) return false;
        final Object this$account = this.getAccount();
        final Object other$account = other.getAccount();
        if (this$account == null ? other$account != null : !this$account.equals(other$account))
            return false;
        final Object this$real_name = this.getReal_name();
        final Object other$real_name = other.getReal_name();
        if (this$real_name == null ? other$real_name != null : !this$real_name.equals(other$real_name))
            return false;
        final Object this$refund_amount = this.getRefund_amount();
        final Object other$refund_amount = other.getRefund_amount();
        if (this$refund_amount == null ? other$refund_amount != null : !this$refund_amount.equals(other$refund_amount))
            return false;
        final Object this$remark = this.getRemark();
        final Object other$remark = other.getRemark();
        if (this$remark == null ? other$remark != null : !this$remark.equals(other$remark))
            return false;
        final Object this$pay_img = this.getPay_img();
        final Object other$pay_img = other.getPay_img();
        if (this$pay_img == null ? other$pay_img != null : !this$pay_img.equals(other$pay_img))
            return false;
        final Object this$ticket_img = this.getTicket_img();
        final Object other$ticket_img = other.getTicket_img();
        if (this$ticket_img == null ? other$ticket_img != null : !this$ticket_img.equals(other$ticket_img))
            return false;
        final Object this$add_time = this.getAdd_time();
        final Object other$add_time = other.getAdd_time();
        if (this$add_time == null ? other$add_time != null : !this$add_time.equals(other$add_time))
            return false;
        if (this.getStatus() != other.getStatus()) return false;
        final Object this$status_detail = this.getStatus_detail();
        final Object other$status_detail = other.getStatus_detail();
        if (this$status_detail == null ? other$status_detail != null : !this$status_detail.equals(other$status_detail))
            return false;
        final Object this$reason = this.getReason();
        final Object other$reason = other.getReason();
        if (this$reason == null ? other$reason != null : !this$reason.equals(other$reason))
            return false;
        final Object this$review_time = this.getReview_time();
        final Object other$review_time = other.getReview_time();
        if (this$review_time == null ? other$review_time != null : !this$review_time.equals(other$review_time))
            return false;
        final Object this$senic_id = this.getSenic_id();
        final Object other$senic_id = other.getSenic_id();
        if (this$senic_id == null ? other$senic_id != null : !this$senic_id.equals(other$senic_id))
            return false;
        final Object this$advance_date = this.getAdvance_date();
        final Object other$advance_date = other.getAdvance_date();
        if (this$advance_date == null ? other$advance_date != null : !this$advance_date.equals(other$advance_date))
            return false;
        final Object this$senic_name = this.getSenic_name();
        final Object other$senic_name = other.getSenic_name();
        if (this$senic_name == null ? other$senic_name != null : !this$senic_name.equals(other$senic_name))
            return false;
        final Object this$address = this.getAddress();
        final Object other$address = other.getAddress();
        if (this$address == null ? other$address != null : !this$address.equals(other$address))
            return false;
        final Object this$thumbnail = this.getThumbnail();
        final Object other$thumbnail = other.getThumbnail();
        if (this$thumbnail == null ? other$thumbnail != null : !this$thumbnail.equals(other$thumbnail))
            return false;
        final Object this$bank = this.getBank();
        final Object other$bank = other.getBank();
        if (this$bank == null ? other$bank != null : !this$bank.equals(other$bank)) return false;
        final Object this$typeText = this.getTypeText();
        final Object other$typeText = other.getTypeText();
        if (this$typeText == null ? other$typeText != null : !this$typeText.equals(other$typeText))
            return false;
        if (this.isCancelable() != other.isCancelable()) return false;
        if (this.isTicketAble() != other.isTicketAble()) return false;
        final Object this$statusStr = this.getStatusStr();
        final Object other$statusStr = other.getStatusStr();
        if (this$statusStr == null ? other$statusStr != null : !this$statusStr.equals(other$statusStr))
            return false;
        if (this.getStatusColor() != other.getStatusColor()) return false;
        return true;
    }

    protected boolean canEqual(final Object other) {
        return other instanceof ReimburseHistoryBean;
    }

    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $advance_id = this.getAdvance_id();
        result = result * PRIME + ($advance_id == null ? 43 : $advance_id.hashCode());
        result = result * PRIME + this.getAccount_type();
        final Object $account = this.getAccount();
        result = result * PRIME + ($account == null ? 43 : $account.hashCode());
        final Object $real_name = this.getReal_name();
        result = result * PRIME + ($real_name == null ? 43 : $real_name.hashCode());
        final Object $refund_amount = this.getRefund_amount();
        result = result * PRIME + ($refund_amount == null ? 43 : $refund_amount.hashCode());
        final Object $remark = this.getRemark();
        result = result * PRIME + ($remark == null ? 43 : $remark.hashCode());
        final Object $pay_img = this.getPay_img();
        result = result * PRIME + ($pay_img == null ? 43 : $pay_img.hashCode());
        final Object $ticket_img = this.getTicket_img();
        result = result * PRIME + ($ticket_img == null ? 43 : $ticket_img.hashCode());
        final Object $add_time = this.getAdd_time();
        result = result * PRIME + ($add_time == null ? 43 : $add_time.hashCode());
        result = result * PRIME + this.getStatus();
        final Object $status_detail = this.getStatus_detail();
        result = result * PRIME + ($status_detail == null ? 43 : $status_detail.hashCode());
        final Object $reason = this.getReason();
        result = result * PRIME + ($reason == null ? 43 : $reason.hashCode());
        final Object $review_time = this.getReview_time();
        result = result * PRIME + ($review_time == null ? 43 : $review_time.hashCode());
        final Object $senic_id = this.getSenic_id();
        result = result * PRIME + ($senic_id == null ? 43 : $senic_id.hashCode());
        final Object $advance_date = this.getAdvance_date();
        result = result * PRIME + ($advance_date == null ? 43 : $advance_date.hashCode());
        final Object $senic_name = this.getSenic_name();
        result = result * PRIME + ($senic_name == null ? 43 : $senic_name.hashCode());
        final Object $address = this.getAddress();
        result = result * PRIME + ($address == null ? 43 : $address.hashCode());
        final Object $thumbnail = this.getThumbnail();
        result = result * PRIME + ($thumbnail == null ? 43 : $thumbnail.hashCode());
        final Object $bank = this.getBank();
        result = result * PRIME + ($bank == null ? 43 : $bank.hashCode());
        final Object $typeText = this.getTypeText();
        result = result * PRIME + ($typeText == null ? 43 : $typeText.hashCode());
        result = result * PRIME + (this.isCancelable() ? 79 : 97);
        result = result * PRIME + (this.isTicketAble() ? 79 : 97);
        final Object $statusStr = this.getStatusStr();
        result = result * PRIME + ($statusStr == null ? 43 : $statusStr.hashCode());
        result = result * PRIME + this.getStatusColor();
        return result;
    }

    public String toString() {
        return "ReimburseHistoryBean(advance_id=" + this.getAdvance_id() + ", account_type=" + this.getAccount_type() + ", account=" + this.getAccount() + ", real_name=" + this.getReal_name() + ", refund_amount=" + this.getRefund_amount() + ", remark=" + this.getRemark() + ", pay_img=" + this.getPay_img() + ", ticket_img=" + this.getTicket_img() + ", add_time=" + this.getAdd_time() + ", status=" + this.getStatus() + ", status_detail=" + this.getStatus_detail() + ", reason=" + this.getReason() + ", review_time=" + this.getReview_time() + ", senic_id=" + this.getSenic_id() + ", advance_date=" + this.getAdvance_date() + ", senic_name=" + this.getSenic_name() + ", address=" + this.getAddress() + ", thumbnail=" + this.getThumbnail() + ", bank=" + this.getBank() + ", typeText=" + this.getTypeText() + ", cancelable=" + this.isCancelable() + ", ticketAble=" + this.isTicketAble() + ", statusStr=" + this.getStatusStr() + ", statusColor=" + this.getStatusColor() + ")";
    }
}
